<script>
	export default {
		// #ifdef	MP-WEIXIN
		globalData: {
			privacyContractName: '', //隐私协议名称 是接口生成的！
			showPrivacy: false //全局控制弹窗显隐
		},
		onLaunch() {
					//privaShow 1需要授权 2不需要授权 3授权失败 4微信版本未达到开启用户隐私协议标准
				if(wx.getPrivacySetting){
					let that = this;
					wx.getPrivacySetting({
						success(res) {
							console.log('是否需要授权：', res.needAuthorization, '隐私协议的名称为：', res.privacyContractName);
							if (res.needAuthorization) {
								that.globalData.privacyContractName = res.privacyContractName;
								that.globalData.showPrivacy = true;
								uni.setStorageSync('privaShow',1)
								
							} else {
								that.globalData.showPrivacy = false;
								uni.setStorageSync('pasteShow',true);
								uni.setStorageSync('privaShow',2)
							}
						}, fail: () => {
							uni.setStorageSync('privaShow',3)
						}
							
					});		
				}else{
					uni.setStorageSync('privaShow',4)	
					}					
		},
		// #endif
		onShow(options) {
			//支付宝外部二维码
			// #ifdef	MP-ALIPAY
			if (options.query && options.query.qrCode) {
				uni.setStorageSync('qrcodeParam', options.query.qrCode);
			} else {
				if (uni.getStorageSync('qrcodeParam')) {
					uni.removeStorageSync('qrcodeParam');
				};
			};
			// #endif
			
			//粉丝团活动
			uni.onAppShow(res => {

				if (this.$utils.isScene(res.scene)) {
					uni.setStorageSync('officialAccount', true);
				} else {
					uni.setStorageSync('officialAccount', false);
				};
			});

			uni.getSystemInfo({
				success: res => {
					let model = res.model;
					//iPhone X距离
					if (model.indexOf('iPhone X') != -1 || model.indexOf('iPhone 12/13') != -1 || model
						.indexOf('iPhone 11') != -1) {
						uni.setStorageSync('apple', true);
					} else {
						uni.setStorageSync('apple', false);
					};
				},
			})
		},


	}
</script>

<style lang="scss">
	@import "uview-ui/index.scss";
	@import "common/common.scss";
	@import "common/iconfont.css";
</style>